if(WScript.Arguments.length==0)
{
    WScript.Echo("Usage UpdChangeSet_VS.js <ProjectPath> [<SvnDir>]");
}
else
{
    var ProjectDir=WScript.Arguments(0).replace(new RegExp("\\\\[^\\\\]+$",""),"");
    var TfsDir=WScript.Arguments.length>=2?WScript.Arguments(1):".";
    
    var Entries=new ActiveXObject("MSXML.DOMDocument");
    Entries.load(TfsDir+"\\_tfs\\entries.xml");
    
    var ChangeSet=Entries.documentElement.selectSingleNode("entry[@name=\"\"]/@changeset").text;

    var fso=new ActiveXObject("Scripting.FileSystemObject");
    var fn=
	    fso.FileExists(ProjectDir+"\\My Project\\AssemblyInfo.vb")?(ProjectDir+"\\My Project\\AssemblyInfo.vb"):
	    fso.FileExists(ProjectDir+"\\My Project\\AssemblyInfo.cs")?(ProjectDir+"\\My Project\\AssemblyInfo.cs"):
	    fso.FileExists(ProjectDir+"\\AssemblyInfo.vb")?(ProjectDir+"\\AssemblyInfo.vb"):
	    fso.FileExists(ProjectDir+"\\AssemblyInfo.cs")?(ProjectDir+"\\AssemblyInfo.cs"):
	    "NoneFound";
    f1=fso.OpenTextFile(fn);
    var dc=f1.ReadAll();
    f1.Close();

    dc=dc.replace(new RegExp("([Aa]ssembly: AssemblyFileVersion(Attribute)?\\(\"[0-9]+?\.[0-9]+?\.[0-9]+?)\.[0-9]+?(\"\\))","m"),"$1."+ChangeSet+"$3");

    f1=fso.CreateTextFile(fn,1);
    f1.Write(dc);
    f1.Close();
}